package com.barry.pattern.commend;

import java.util.LinkedList;


public class Waiter {
	LinkedList<Order> orders=new LinkedList<Order>();
	public void addOrder(Order order,OrderExecuter executer) {
		order.setExecuter(executer);
		this.orders.add(order);
	}
	
	public void addOrder(LinkedList<Order> orders,OrderExecuter executer) {
		for(Order order:this.orders){
			order.setExecuter(executer);
		}
		this.orders.addAll(orders);
	}
	
	public void setAllExecute(OrderExecuter executer){
		for(Order order:this.orders){
			order.setExecuter(executer);
		}
	}
	
	public void notice() {
		 for (Order order:orders) {
			 order.getExecuter().executeOrder(order);
		}
	}
	
}
